const mock = {
  visitData: [
    {
      x: '2018-08-10',
      y: 7
    },
    {
      x: '2018-08-11',
      y: 5
    },
    {
      x: '2018-08-12',
      y: 4
    },
    {
      x: '2018-08-13',
      y: 2
    },
    {
      x: '2018-08-14',
      y: 4
    },
    {
      x: '2018-08-15',
      y: 7
    },
    {
      x: '2018-08-16',
      y: 5
    },
    {
      x: '2018-08-17',
      y: 6
    },
    {
      x: '2018-08-18',
      y: 5
    },
    {
      x: '2018-08-19',
      y: 9
    },
    {
      x: '2018-08-20',
      y: 6
    },
    {
      x: '2018-08-21',
      y: 3
    },
    {
      x: '2018-08-22',
      y: 1
    },
    {
      x: '2018-08-23',
      y: 5
    },
    {
      x: '2018-08-24',
      y: 3
    },
    {
      x: '2018-08-25',
      y: 6
    },
    {
      x: '2018-08-26',
      y: 5
    }
  ],
  visitData2: [
    {
      x: '2018-08-10',
      y: 1
    },
    {
      x: '2018-08-11',
      y: 6
    },
    {
      x: '2018-08-12',
      y: 4
    },
    {
      x: '2018-08-13',
      y: 8
    },
    {
      x: '2018-08-14',
      y: 3
    },
    {
      x: '2018-08-15',
      y: 7
    },
    {
      x: '2018-08-16',
      y: 2
    }
  ],
  visitData3: [
    
    {
      x: '2018-08-11',
      y: 7
    },
    {
      x: '2018-08-12',
      y: 2
    },
    {
      x: '2018-08-13',
      y: 6
    },
    {
      x: '2018-08-14',
      y: 2
    },
    {
      x: '2018-08-15',
      y: 8
    },
    {
      x: '2018-08-16',
      y: 4
    }
  ],
  visitData4: [
    
    {
      x: '2018-08-11',
      y: 7
    },
    {
      x: '2018-08-12',
      y: 9
    },
    {
      x: '2018-08-13',
      y: 5
    },
    {
      x: '2018-08-14',
      y: 7
    },
    {
      x: '2018-08-15',
      y: 6
    },
  ],
  salesData: [
    {
      x: '1月',
      y: 706
    },
    {
      x: '2月',
      y: 463
    },
    {
      x: '3月',
      y: 1173
    },
    {
      x: '4月',
      y: 1021
    },
    {
      x: '5月',
      y: 203
    },
    {
      x: '6月',
      y: 465
    },
    {
      x: '7月',
      y: 894
    },
    {
      x: '8月',
      y: 1099
    },
    {
      x: '9月',
      y: 1072
    },
    {
      x: '10月',
      y: 1069
    },
    {
      x: '11月',
      y: 423
    },
    {
      x: '12月',
      y: 771
    }
  ],
  searchData: [
    {
      index: 1,
      keyword: '搜索关键词-0',
      count: 649,
      range: 22,
      status: 0
    },
    {
      index: 2,
      keyword: '搜索关键词-1',
      count: 21,
      range: 26,
      status: 0
    },
    {
      index: 3,
      keyword: '搜索关键词-2',
      count: 537,
      range: 65,
      status: 1
    },
    {
      index: 4,
      keyword: '搜索关键词-3',
      count: 601,
      range: 13,
      status: 1
    },
    {
      index: 5,
      keyword: '搜索关键词-4',
      count: 433,
      range: 13,
      status: 1
    },
    {
      index: 6,
      keyword: '搜索关键词-5',
      count: 504,
      range: 67,
      status: 0
    },
    {
      index: 7,
      keyword: '搜索关键词-6',
      count: 700,
      range: 55,
      status: 0
    },
    {
      index: 8,
      keyword: '搜索关键词-7',
      count: 999,
      range: 0,
      status: 1
    },
    {
      index: 9,
      keyword: '搜索关键词-8',
      count: 118,
      range: 31,
      status: 1
    },
    {
      index: 10,
      keyword: '搜索关键词-9',
      count: 499,
      range: 12,
      status: 0
    },
    {
      index: 11,
      keyword: '搜索关键词-10',
      count: 135,
      range: 45,
      status: 0
    },
    {
      index: 12,
      keyword: '搜索关键词-11',
      count: 196,
      range: 20,
      status: 0
    },
    {
      index: 13,
      keyword: '搜索关键词-12',
      count: 144,
      range: 10,
      status: 0
    },
    {
      index: 14,
      keyword: '搜索关键词-13',
      count: 77,
      range: 6,
      status: 0
    },
    {
      index: 15,
      keyword: '搜索关键词-14',
      count: 338,
      range: 12,
      status: 0
    },
    {
      index: 16,
      keyword: '搜索关键词-15',
      count: 699,
      range: 24,
      status: 0
    },
    {
      index: 17,
      keyword: '搜索关键词-16',
      count: 161,
      range: 57,
      status: 1
    },
    {
      index: 18,
      keyword: '搜索关键词-17',
      count: 337,
      range: 86,
      status: 0
    },
    {
      index: 19,
      keyword: '搜索关键词-18',
      count: 829,
      range: 6,
      status: 1
    },
    {
      index: 20,
      keyword: '搜索关键词-19',
      count: 380,
      range: 91,
      status: 1
    },
    {
      index: 21,
      keyword: '搜索关键词-20',
      count: 4,
      range: 31,
      status: 1
    },
    {
      index: 22,
      keyword: '搜索关键词-21',
      count: 390,
      range: 0,
      status: 0
    },
    {
      index: 23,
      keyword: '搜索关键词-22',
      count: 808,
      range: 31,
      status: 0
    },
    {
      index: 24,
      keyword: '搜索关键词-23',
      count: 343,
      range: 36,
      status: 0
    },
    {
      index: 25,
      keyword: '搜索关键词-24',
      count: 873,
      range: 36,
      status: 1
    },
    {
      index: 26,
      keyword: '搜索关键词-25',
      count: 453,
      range: 96,
      status: 0
    },
    {
      index: 27,
      keyword: '搜索关键词-26',
      count: 717,
      range: 14,
      status: 0
    },
    {
      index: 28,
      keyword: '搜索关键词-27',
      count: 447,
      range: 8,
      status: 0
    },
    {
      index: 29,
      keyword: '搜索关键词-28',
      count: 111,
      range: 78,
      status: 1
    },
    {
      index: 30,
      keyword: '搜索关键词-29',
      count: 751,
      range: 10,
      status: 0
    },
    {
      index: 31,
      keyword: '搜索关键词-30',
      count: 734,
      range: 46,
      status: 0
    },
    {
      index: 32,
      keyword: '搜索关键词-31',
      count: 950,
      range: 97,
      status: 0
    },
    {
      index: 33,
      keyword: '搜索关键词-32',
      count: 969,
      range: 16,
      status: 0
    },
    {
      index: 34,
      keyword: '搜索关键词-33',
      count: 888,
      range: 16,
      status: 0
    },
    {
      index: 35,
      keyword: '搜索关键词-34',
      count: 484,
      range: 62,
      status: 1
    },
    {
      index: 36,
      keyword: '搜索关键词-35',
      count: 349,
      range: 4,
      status: 0
    },
    {
      index: 37,
      keyword: '搜索关键词-36',
      count: 130,
      range: 18,
      status: 0
    },
    {
      index: 38,
      keyword: '搜索关键词-37',
      count: 440,
      range: 96,
      status: 1
    },
    {
      index: 39,
      keyword: '搜索关键词-38',
      count: 879,
      range: 58,
      status: 1
    },
    {
      index: 40,
      keyword: '搜索关键词-39',
      count: 402,
      range: 91,
      status: 0
    },
    {
      index: 41,
      keyword: '搜索关键词-40',
      count: 573,
      range: 53,
      status: 1
    },
    {
      index: 42,
      keyword: '搜索关键词-41',
      count: 580,
      range: 11,
      status: 0
    },
    {
      index: 43,
      keyword: '搜索关键词-42',
      count: 757,
      range: 40,
      status: 0
    },
    {
      index: 44,
      keyword: '搜索关键词-43',
      count: 416,
      range: 89,
      status: 0
    },
    {
      index: 45,
      keyword: '搜索关键词-44',
      count: 880,
      range: 23,
      status: 0
    },
    {
      index: 46,
      keyword: '搜索关键词-45',
      count: 318,
      range: 46,
      status: 0
    },
    {
      index: 47,
      keyword: '搜索关键词-46',
      count: 55,
      range: 58,
      status: 1
    },
    {
      index: 48,
      keyword: '搜索关键词-47',
      count: 7,
      range: 64,
      status: 1
    },
    {
      index: 49,
      keyword: '搜索关键词-48',
      count: 125,
      range: 50,
      status: 0
    },
    {
      index: 50,
      keyword: '搜索关键词-49',
      count: 631,
      range: 18,
      status: 0
    }
  ],
  offlineData: [
    {
      name: '应用一',
      cvr: 0.6
    },
    {
      name: '应用二',
      cvr: 0.5
    },
    {
      name: '应用三',
      cvr: 0.1
    },
    {
      name: '应用四',
      cvr: 0.9
    },
    {
      name: '应用五',
      cvr: 0.5
    },
    {
      name: '应用六',
      cvr: 0.4
    },
    {
      name: '应用七',
      cvr: 0.7
    },
    {
      name: '应用八',
      cvr: 0.2
    },
    {
      name: '应用九',
      cvr: 0.2
    },
    {
      name: '应用十',
      cvr: 0.2
    }
  ],
  offlineChartData: [
    {
      x: 1533915787721,
      y1: 66,
      y2: 13
    },
    {
      x: 1533917587721,
      y1: 98,
      y2: 36
    },
    {
      x: 1533919387721,
      y1: 71,
      y2: 51
    },
    {
      x: 1533921187721,
      y1: 31,
      y2: 103
    },
    {
      x: 1533922987721,
      y1: 59,
      y2: 45
    },
    {
      x: 1533924787721,
      y1: 89,
      y2: 38
    },
    {
      x: 1533926587721,
      y1: 93,
      y2: 70
    },
    {
      x: 1533928387721,
      y1: 29,
      y2: 106
    },
    {
      x: 1533930187721,
      y1: 78,
      y2: 51
    },
    {
      x: 1533931987721,
      y1: 13,
      y2: 63
    },
    {
      x: 1533933787721,
      y1: 78,
      y2: 91
    },
    {
      x: 1533935587721,
      y1: 102,
      y2: 51
    },
    {
      x: 1533937387721,
      y1: 42,
      y2: 98
    },
    {
      x: 1533939187721,
      y1: 59,
      y2: 12
    },
    {
      x: 1533940987721,
      y1: 63,
      y2: 74
    },
    {
      x: 1533942787721,
      y1: 72,
      y2: 71
    },
    {
      x: 1533944587721,
      y1: 47,
      y2: 47
    },
    {
      x: 1533946387721,
      y1: 13,
      y2: 13
    },
    {
      x: 1533948187721,
      y1: 26,
      y2: 54
    },
    {
      x: 1533949987721,
      y1: 39,
      y2: 30
    }
  ],
  salesTypeData: [
    {
      x: '民警',
      y: 4544
    },
    {
      x: '现役',
      y: 3321
    },
    {
      x: '辅警',
      y: 3113
    },
    {
      x: '在编工勤',
      y: 2341
    },
    {
      x: '外部党政人员',
      y: 1231
    },
    {
      x: '其他',
      y: 1231
    }
  ],
  salesTypeDataOnline: [
    {
      x: '家用电器',
      y: 244
    },
    {
      x: '食用酒水',
      y: 321
    },
    {
      x: '个护健康',
      y: 311
    },
    {
      x: '服饰箱包',
      y: 41
    },
    {
      x: '母婴产品',
      y: 121
    },
    {
      x: '其他',
      y: 111
    }
  ],
  salesTypeDataOffline: [
    {
      x: '家用电器',
      y: 99
    },
    {
      x: '个护健康',
      y: 188
    },
    {
      x: '服饰箱包',
      y: 344
    },
    {
      x: '母婴产品',
      y: 255
    },
    {
      x: '其他',
      y: 65
    }
  ],
  radarData: [
    {
      name: '个人',
      label: '引用',
      value: 10
    },
    {
      name: '个人',
      label: '口碑',
      value: 8
    },
    {
      name: '个人',
      label: '产量',
      value: 4
    },
    {
      name: '个人',
      label: '贡献',
      value: 5
    },
    {
      name: '个人',
      label: '热度',
      value: 7
    },
    {
      name: '团队',
      label: '引用',
      value: 3
    },
    {
      name: '团队',
      label: '口碑',
      value: 9
    },
    {
      name: '团队',
      label: '产量',
      value: 6
    },
    {
      name: '团队',
      label: '贡献',
      value: 3
    },
    {
      name: '团队',
      label: '热度',
      value: 1
    },
    {
      name: '部门',
      label: '引用',
      value: 4
    },
    {
      name: '部门',
      label: '口碑',
      value: 1
    },
    {
      name: '部门',
      label: '产量',
      value: 6
    },
    {
      name: '部门',
      label: '贡献',
      value: 5
    },
    {
      name: '部门',
      label: '热度',
      value: 7
    }
  ],
  LineData: [
    {
      year: '10:00',
      value: 1
    },
    {
      year: '11:00',
      value: 3
    },
    {
      year: '12:00',
      value: 4
    },
    {
      year: '13:00',
      value: 3.5
    },
    {
      year: '14:00',
      value: 5
    },
    {
      year: '15:00',
      value: 4.9
    },
    {
      year: '16:00',
      value: 6
    },
    {
      year: '17:00',
      value: 7
    },
  ]
};
export default {
  namespace: 'chart',

  state: {
    visitData: [],
    visitData2: [],
    visitData3: [],
    visitData4: [],
    salesData: [],
    searchData: [],
    offlineData: [],
    offlineChartData: [],
    salesTypeData: [],
    salesTypeDataOnline: [],
    salesTypeDataOffline: [],
    radarData: [],
    LineData: [],
    loading: false
  },

  effects: {
    *fetch(_, { put, call }) {
      yield call(
        () =>
          new Promise(resolve => {
            setTimeout(() => {
              resolve();
            }, 100);
          })
      );
      yield put({
        type: 'save',
        payload: mock
      });
    },
    *fetchSalesData(_, { put }) {
      yield put({
        type: 'save',
        payload: mock
      });
    }
  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload
      };
    },
    clear() {
      return {
        visitData: [],
        visitData2: [],
        visitData3: [],
        visitData4: [],
        salesData: [],
        searchData: [],
        offlineData: [],
        offlineChartData: [],
        salesTypeData: [],
        salesTypeDataOnline: [],
        salesTypeDataOffline: [],
        radarData: [],
        LineData: []
      };
    }
  }
};
